package com.tvunetworks.center.user.controller.feign;

import com.tvunetworks.center.common.feign.OverWatchFeignInterface;
import com.tvunetworks.center.common.util.Result;
import com.tvunetworks.center.common.util.ResultUtil;
import com.tvunetworks.center.user.service.OverWatchService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Etan Yang
 * @data: 6/23/2020 10:13 AM
 * @program: tvucc-aggregator
 * @description:
 */

@RestController
@RequestMapping("/feign/overWatch")
@Slf4j
public class OverWatchFeignController implements OverWatchFeignInterface {
    @Autowired
    private OverWatchService overWatchService;

    @Override
    public Result<Object> updateCurrConnectNum(@RequestParam String rid, @RequestParam boolean numFlag){
        int result = overWatchService.updateCurrConnectNum(rid, numFlag);
        if (result == 1) {
            return ResultUtil.error("81002004", "over Watch not exist");
        }
        return ResultUtil.success();
    }

    @Override
    public boolean checkCurrConnectCount(String rid) {
        return overWatchService.checkCurrConnectCount(rid);
    }


}
